const modules = require("../src/components/index.js");

const commonPrompt = [
  () => ({
    type: "select",
    name: "value",
    message: "请选择模块大类：",
    choices: modules.map((module) => ({
      title: module.desc,
      value: module.components,
    })),
  }),
  (res) => {
    const { value } = res[0];
    return {
      type: "select",
      name: "value",
      message: "请选择模块类型：",
      choices: value.map((comp) => ({ title: comp.desc, value: comp })),
    };
  },
  () => ({
    type: "text",
    name: "value",
    message: "请输入模块名称：",
  }),
  () => ({
    type: "text",
    name: "value",
    message: "请输入目标文件路径：",
  }),
];
module.exports.commonPrompt = commonPrompt;
